<template>
  <div id="clinicDetail">
    <header>
      <i @click="goBack()"></i>
      <div>我的写卡消息</div>
    </header>
    <div class="nav">
      <!-- <div  class='active' @click='getNewsList(0,sentPage,"click")'>
  				<a class="abstract">
	  				<b>上传Ic卡</b>
	  			</a>
  			</div>
  			<div  @click='getNewsList(1,sentPage,"click")'>
		  		<a class="newfresh">
		  			<b>设置Ic卡</b>
		  		</a>
	  		</div> -->
    </div>
    <div class="swipe">
      <div class="box">
        <ul>
          <li>
            <span>IC卡数据:</span>
            <input type="text" v-model="icObj.data">
          </li>
        </ul>
        <div class='sure'>
          <a @click='sureFun'>确 定</a>
        </div>
      </div>

      <div class="box">
        <ul>
          <li>
            <span>SSID:</span>
            <input type="text" v-model="obj.ssid">
          </li>
          <li>
            <span>密码:</span>
            <input type="text" v-model="obj.password">
          </li>
          <li>
            <span>Ip地址:</span>
            <input type="text" v-model="obj.ip">
          </li>
          <li>
            <span>端口号:</span>
            <input type="text" v-model="obj.port">
          </li>
          <li>
            <span>控制器名称:</span>
            <input type="text" v-model="obj.ctrlname">
          </li>
        </ul>
        <div class='sure'>
          <a @click='sureFun1'>确 定</a>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
  export default {
    data() {
      return {
        obj: {
          ssid: '',
          password: '',
          ip: '',
          port: '',
          ctrlname: ''
        },
        icObj:{
            data:''
        },


        list: [],
        userid: '',
        type: 'all', //全部消息 系统消息 all window
        isShow: true,
      }
    },
    methods: {
      goBack() {
        this.$router.push({
          path: '/my'
        })
      },
      sureFun1() {
          //alert("配置");
          this.$api.post(this.$api.baseURLSchool, "/chair/write_card/config", this.obj, r => {
            console.log(r);
            if (r.data.ret == 1) {
            //   if (r.data.info.per_app_status == "1") {
            //     this.$router.push({
            //       name: 'doctorvipAuth1'
            //     });
            //   } else {
            //     this.$router.push({
            //       name: 'authentication'
            //     });
            //   }
            }
          }, err => {
            console.log(err);
          })

      },
      sureFun() {
       // alert("上传");
        var len = this.icObj.data.replace(/[^\x00-\xff]/g, "**").length;
        if (len < 16) {
          this.$api.post(this.$api.baseURLSchool, "/chair/write_card/upload",this.icObj, r => {
            console.log('写卡 is',r.data);
            if (r.data.ret == 1) {
            //   if (r.data.info.per_app_status == "1") {
            //     this.$router.push({
            //       name: 'doctorvipAuth1'
            //     });
            //   } else {
            //     this.$router.push({
            //       name: 'authentication'
            //     });
            //   }
            }
          }, err => {
            console.log(err);
          })
        } else {
          this.$utils._toast("请输入合格的内容");
        }


      },

    },
    created() {}
  }

</script>
<style lang="scss" scoped>
  .mc {
    padding: 40px 0;
    margin: auto;
    position: absolute;
    left: 50%;
    top: 40%;
    transform: translate(-50%, -50%);

    img {
      display: block;
      margin: 0 auto;
    }

    p {
      padding-top: 10px;
      text-align: center;
    }
  }

</style>
